clear all
set printcolor gs1, permanently
set more off

use product year firm revenue module group censored age cohort using "INTERMEDIATE/product_RMS_def10_firm_sampleE_06_15_annual.dta", clear

keep if firm ==43404 
drop if cohort==.

gcollapse (sum) revenue, by(cohort year firm) fast 
order firm year cohort
sort firm year cohort
bysort firm: gen N=_N
keep if N==55
drop N
replace revenue=revenue/1000000
drop firm

reshape wide revenue, i(year) j(cohort)
rename revenue2006 revenue_6
egen revenue_6_7=rowtotal(revenue_6 revenue2007)
egen revenue_6_8=rowtotal(revenue_6_7 revenue2008)
egen revenue_6_9=rowtotal(revenue_6_8 revenue2009)
egen revenue_6_10=rowtotal(revenue_6_9 revenue2010)
egen revenue_6_11=rowtotal(revenue_6_10 revenue2011)
egen revenue_6_12=rowtotal(revenue_6_11 revenue2012)
egen revenue_6_13=rowtotal(revenue_6_12 revenue2013)
egen revenue_6_14=rowtotal(revenue_6_13 revenue2014)
egen revenue_6_15=rowtotal(revenue_6_14 revenue2015)

gen norm_revenue_6=1+(revenue_6-revenue_6[1])/revenue_6[1]
gen norm_revenue_6_7=1+(revenue_6_7-revenue_6_7[1])/revenue_6_7[1]
gen norm_revenue_6_8=1+(revenue_6_8-revenue_6_8[1])/revenue_6_8[1]
gen norm_revenue_6_9=1+(revenue_6_9-revenue_6_9[1])/revenue_6_9[1]
gen norm_revenue_6_10=1+(revenue_6_10-revenue_6_10[1])/revenue_6_10[1]
gen norm_revenue_6_11=1+(revenue_6_11-revenue_6_11[1])/revenue_6_11[1]
gen norm_revenue_6_12=1+(revenue_6_12-revenue_6_12[1])/revenue_6_12[1]
gen norm_revenue_6_13=1+(revenue_6_13-revenue_6_13[1])/revenue_6_13[1]
gen norm_revenue_6_14=1+(revenue_6_14-revenue_6_14[1])/revenue_6_14[1]
gen norm_revenue_6_15=1+(revenue_6_15-revenue_6_15[1])/revenue_6_15[1]


#delimit;
twoway 
(line norm_revenue_6 year, color(green) lwidth(thick) lpattern(dash_dot))
(line norm_revenue_6_7 year, color(cranberry) lwidth(thick) lpattern(dash_dot))
(line norm_revenue_6_8 year, color(purple) lwidth(thick) lpattern(dash_dot))
(line norm_revenue_6_9 year, color(magenta) lwidth(thick) lpattern(dash_dot))
(line norm_revenue_6_10 year, color(pink) lwidth(thick) lpattern(dash_dot)) 
(line norm_revenue_6_11 year, color(blue) lwidth(thick) lpattern(dash_dot))
(line norm_revenue_6_12 year, color(midblue) lwidth(thick) lpattern(dash_dot)) 
(line norm_revenue_6_13 year, color(ebblue) lwidth(thick) lpattern(dash_dot))
(line norm_revenue_6_14 year, color(navy) lwidth(thick) lpattern(dash_dot))
(line norm_revenue_6_15 year, color(black) lwidth(thick))
, ytitle("Sales (in percent, normalized)" " ")
legend(off) 
xtitle(Year) ylabel(0(0.2)1.3) xlabel(2007[2]2015)
graphregion(color(white)) plotregion(fcolor(white));	
#delimit cr 
graph export "OUTPUT/Figure1.eps", replace

